class: center, middle, title-slide .title[ # Presentation Ninja ] .subtitle[ ## with xaringan ] .author[ ### Yihui Xie ] .date[ ### 2016/12/12 ] --- One slide. --- class: right, middle name: something The other. ```r knitr::kable(head(iris), 'html') ``` --- class: center background-image: url("data:image/png;base64,#images/cool.jpg") background-position: center background-size: cover # A new slide Content. --- class: middle, center The holy passion of Friendship is of so sweet and steady and loyal and enduring a nature that it will last through a whole lifetime... .right[--Mark Twain] ??? _if not asked to lend money_. --- Mark Twain --- class: center, middle # Level 1 Title ## Level 2 Title Text <img src="data:image/png;base64,#http://bit.ly/wiki-toddy" width="15%" align="right" /> Pictures like this  --- # Incremental reveals # Hi there My name is Alison -- I like hot toddies -- `#rdogladies` -- and babies --- .pull-left[ Multi ] .pull-right[BBB sss ] --- # Left Column .left-column[ what did you say?  The left has only ## 25% Holy Shit ] .right-column[ you'd better  But ] --- # Code Hightlight ```r library(babynames) ``` ``` ## Warning: package 'babynames' was built under R version 4.2.3 ``` ```r library(tidyverse) ``` ``` ## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── ## ✔ ggplot2 3.4.2 ✔ purrr 1.0.1 ## ✔ tibble 3.2.1 ✔ dplyr 1.1.0 ## ✔ tidyr 1.3.0 ✔ stringr 1.5.0 ## ✔ readr 2.1.4 ✔ forcats 1.0.0 ``` ``` ## Warning: package 'ggplot2' was built under R version 4.2.3 ``` ``` ## Warning: package 'tibble' was built under R version 4.2.3 ``` ``` ## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ## ✖ dplyr::filter() masks stats::filter() ## ✖ dplyr::lag() masks stats::lag() ``` ```r tx_names <- babynames %>% filter(name == "Dallas" | name == "Austin") %>% filter(sex == "F") *glimpse(tx_names) ``` ``` ## Rows: 171 ## Columns: 5 ## $ year <dbl> 1892, 1894, 1896, 1899, 1900, 1903, 1904, 1905, 1906, 1907, 1908,… ## $ sex <chr> "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", "F", … ## $ name <chr> "Dallas", "Dallas", "Dallas", "Dallas", "Dallas", "Dallas", "Dall… ## $ n <int> 9, 6, 7, 6, 9, 9, 9, 12, 8, 7, 14, 11, 20, 19, 24, 16, 28, 30, 5,… ## $ prop <dbl> 4.002e-05, 2.543e-05, 2.778e-05, 2.424e-05, 2.832e-05, 3.235e-05,… ``` --- ```r head(babynames) ``` ``` *## # A tibble: 6 × 5 ## year sex name n prop *## <dbl> <chr> <chr> <int> <dbl> ## 1 1880 F Mary 7065 0.0724 ## 2 1880 F Anna 2604 0.0267 ## 3 1880 F Emma 2003 0.0205 ## 4 1880 F Elizabeth 1939 0.0199 ## 5 1880 F Minnie 1746 0.0179 ## 6 1880 F Margaret 1578 0.0162 ``` --- # Other Output .pull-left[ ### Kable ```r head(babynames) %>% knitr::kable(format = "html") ``` <table> <thead> <tr> <th style="text-align:right;"> year </th> <th style="text-align:left;"> sex </th> <th style="text-align:left;"> name </th> <th style="text-align:right;"> n </th> <th style="text-align:right;"> prop </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Mary </td> <td style="text-align:right;"> 7065 </td> <td style="text-align:right;"> 0.0723836 </td> </tr> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Anna </td> <td style="text-align:right;"> 2604 </td> <td style="text-align:right;"> 0.0266790 </td> </tr> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Emma </td> <td style="text-align:right;"> 2003 </td> <td style="text-align:right;"> 0.0205215 </td> </tr> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Elizabeth </td> <td style="text-align:right;"> 1939 </td> <td style="text-align:right;"> 0.0198658 </td> </tr> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Minnie </td> <td style="text-align:right;"> 1746 </td> <td style="text-align:right;"> 0.0178884 </td> </tr> <tr> <td style="text-align:right;"> 1880 </td> <td style="text-align:left;"> F </td> <td style="text-align:left;"> Margaret </td> <td style="text-align:right;"> 1578 </td> <td style="text-align:right;"> 0.0161672 </td> </tr> </tbody> </table> ] .pull-right[ ### gt ```r library(gt) ``` ``` ## Warning: package 'gt' was built under R version 4.2.3 ``` ```r head(babynames) %>% gt() ```
year
sex
name
n
prop
1880
F
Mary
7065
0.07238359
1880
F
Anna
2604
0.02667896
1880
F
Emma
2003
0.02052149
1880
F
Elizabeth
1939
0.01986579
1880
F
Minnie
1746
0.01788843
1880
F
Margaret
1578
0.01616720
] --- ```r library(DT) tx_names %>% datatable() ```
--- .left-column[ # leaflet ] .right-column[ ```r library(leaflet) leaflet() %>% addTiles() %>% setView(lat = 30.2621, lng = -97.7382, zoom = 17) ```
] --- # ggplot ```r library(ggplot2) tx_names %>% group_by(name) %>%summarise(count =n()) %>% ggplot(aes(x=name,y=count)) + geom_col() ``` <img src="data:image/png;base64,#xaringan_sample_files/figure-html/ggp-1.png" width="504" /> --- # Code and plot side by side .pull-left[ ```r tx_names %>% group_by(name) %>% summarise(count =n()) %>% ggplot(aes(x=name,y=count)) + geom_col() ``` ] .pull-right[ <!-- --> ]